<?php
namespace App\Repositories;

use App\Exceptions\BasicException;
use Illuminate\Support\Facades\Redis;


class UserNewsRepository
{
    /**
     * 添加通知
     * @param $data
     * @return mixed
     * @throws BasicException
     */
    public function userNewsAdd($data)
    {
        $userNews = app('model_user_news')->create($data);
        if ($userNews) {
            Redis::del('user:news:count:' . $data['user_id']);
            Redis::del('user:news:info:' . $data['user_id']);
            return $userNews;
        }
        throw new BasicException(70009);
    }
}


?>